#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "window.h"


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    texDir="D:\\swdol\\TEX";
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    QString filename =QFileDialog::getExistingDirectory(this,tr("请选择轩辕剑贴图目录"),tr("D:\\swdol\\TEX"));
    if(filename.isEmpty()){
        QMessageBox::warning(this, tr("出错~"),tr("没有打开文件路径~"));
        return;
    }
    texDir=filename;
    ui->lineEdit->setText(texDir);
}

void MainWindow::on_pushButton_2_clicked()
{
    QString filename = QFileDialog::getOpenFileName(this,tr("请打开轩辕剑PLY模型文件"),tr("D:\\swdol\\MODEL"));
    if(filename.isEmpty()){
        QMessageBox::warning(this, tr("出错~"),tr("没有打开文件路径~"));
        return;
    }
    ui->lineEdit_2->setText(filename);
    //myGLWidget *w=new myGLWidget(0,filename);
    Window *w=new Window(filename, texDir);
    //w->setTexDir(texDir);
    w->show();
}
